package com.dotstone.chipism.view;

import com.dotstone.chipism.R;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class TakeOrderDialog extends Dialog implements View.OnClickListener {
	private OnEnsureOptionListener ensureOptionListener;
	private OnCancelOptionListener cancelOptionListener;
	private Button mCancelB;
	private Button mEnsureB;
	private TextView mTake;
	public TakeOrderDialog(Context context) {

		super(context, R.style.DIYDialog);
		this.setContentView(R.layout.dialog_take_order);
		this.getWindow().getAttributes().gravity = Gravity.CENTER;
		initView();
		initEvent();
	}

	private void initView() {
		mCancelB = (Button)findViewById(R.id.cancel_btn4);
		mEnsureB = (Button)findViewById(R.id.ensure_btn4);
		mTake = (TextView)findViewById(R.id.take);
	}

	private void initEvent() {
		mCancelB.setOnClickListener(this);
		mEnsureB.setOnClickListener(this);
	}

	public void setMsg(String msg) {
		mTake.setText(msg);
	}

	@Override
	public void onClick(View v) {

		switch (v.getId()) {
		case R.id.cancel_btn:
			cancelOptionListener.cancel();
			break;
		case R.id.ensure_btn:
			ensureOptionListener.ensure();
			break;
		default:
			break;
		}
	}

	public void setOnCancelOptionListener(
			OnCancelOptionListener onCancelOptionListener) {
		this.cancelOptionListener = onCancelOptionListener;
	}

	public void setOnEnsureOptionListener(
			OnEnsureOptionListener onEnsureOptionListener) {
		this.ensureOptionListener = onEnsureOptionListener;
	}

	public interface OnEnsureOptionListener {
		public void ensure();
	}

	public interface OnCancelOptionListener {
		public void cancel();
	}
}
